Skip to content

fix: restore mobile swipe position when returning from external links - #139

Merged
therealsama merged 1 commit into
mainfrom
fix/restore-swipe-position
Jun 8, 2026
Merged

therealsama merged 1 commit into
mainfrom
fix/restore-swipe-position

Conversation

@therealsama

@therealsama therealsama commented Jun 8, 2026 •

Copy link
Copy Markdown
Collaborator

On a full reload (bfcache miss), the swipe index was lost and the story
collapsed to index 0. Persist a durable per-tab snapshot (viewer, story
id, scrollY, and a lean story list) to sessionStorage, then on mount
re-find the story by id at its prior position with its neighbors.

  • Add swipePosition helper + SwipePosition type (30-min TTL, lean
    projection omitting text, snapshot taken from the feed front through a
    small look-ahead so a prepended restore preserves feed order)
  • Recover the originating viewer (feed/domain/user) on a stateless
    reload in MobileItemDetailWrapper
  • Seed the restored list into mergedStories and freeze the restore
    decision at mount so the list does not collapse on first swipe
  • Guard the injection fetch so a restored story is never re-fetched

@therealsama
therealsama requested a review from kplachkov as a code owner June 8, 2026 13:51
@therealsama
therealsama force-pushed the fix/restore-swipe-position branch 4 times, most recently from 314521a to 73c13b6 Compare June 8, 2026 18:51
On a full reload (bfcache miss), the swipe index was lost and the story
collapsed to index 0. Persist a durable per-tab snapshot (viewer, story
id, scrollY, and a lean story list) to sessionStorage, then on mount
re-find the story by id at its prior position with its neighbors.

- Add swipePosition helper + SwipePosition type (30-min TTL, lean
  projection omitting text, snapshot taken from the feed front through a
  small look-ahead so a prepended restore preserves feed order)
- Recover the originating viewer (feed/domain/user) on a stateless
  reload in MobileItemDetailWrapper
- Seed the restored list into mergedStories and freeze the restore
  decision at mount so the list does not collapse on first swipe
- Guard the injection fetch so a restored story is never re-fetched
@therealsama
therealsama force-pushed the fix/restore-swipe-position branch from 73c13b6 to 55312ee Compare June 8, 2026 19:18
@therealsama
therealsama enabled auto-merge June 8, 2026 19:19
@therealsama
therealsama merged commit 2e67826 into main Jun 8, 2026
4 checks passed
@therealsama
therealsama deleted the fix/restore-swipe-position branch June 8, 2026 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants